#!/bin/sh

# skil root dev
ROOT_DEV=`readlink /dev/root`
[ "x$MDEV" = "x$ROOT_DEV" ] && exit 0

if [ $ACTION = "add" ] ; then
	if [ -d /sys/block/*/$MDEV ] ; then
	  mkdir -p /run/media/$MDEV
	  mount /dev/$MDEV /run/media/$MDEV || rm -rf /run/media/$MDEV
	fi
elif [ $ACTION = "remove" ] ; then
	if [ -d /run/media/$MDEV ] ; then
		umount /run/media/$MDEV
		rm -rf /run/media/$MDEV
	fi
fi
